<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/doc/src/qtdesigner.qdoc -->
<head>
  <title>Qt 4.3: QDesignerMemberSheetExtension Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QDesignerMemberSheetExtension Class Reference<br /><sup><sup>[<a href="qtdesigner.html">QtDesigner</a> module]</sup></sup></h1>
<p>The QDesignerMemberSheetExtension class allows you to manipulate a widget's member functions which is displayed when configuring connections using Qt Designer's mode for editing signals and slots. <a href="#details">More...</a></p>
<pre> #include &lt;QDesignerMemberSheetExtension&gt;</pre><ul>
<li><a href="qdesignermembersheetextension-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/>virtual <b><a href="qdesignermembersheetextension.html#dtor.QDesignerMemberSheetExtension">~QDesignerMemberSheetExtension</a></b> ()</li>
<li><div class="fn"/>virtual int <b><a href="qdesignermembersheetextension.html#count">count</a></b> () const = 0</li>
<li><div class="fn"/>virtual QString <b><a href="qdesignermembersheetextension.html#declaredInClass">declaredInClass</a></b> ( int <i>index</i> ) const = 0</li>
<li><div class="fn"/>virtual int <b><a href="qdesignermembersheetextension.html#indexOf">indexOf</a></b> ( const QString &amp; <i>name</i> ) const = 0</li>
<li><div class="fn"/>virtual bool <b><a href="qdesignermembersheetextension.html#inheritedFromWidget">inheritedFromWidget</a></b> ( int <i>index</i> ) const = 0</li>
<li><div class="fn"/>virtual bool <b><a href="qdesignermembersheetextension.html#isSignal">isSignal</a></b> ( int <i>index</i> ) const = 0</li>
<li><div class="fn"/>virtual bool <b><a href="qdesignermembersheetextension.html#isSlot">isSlot</a></b> ( int <i>index</i> ) const = 0</li>
<li><div class="fn"/>virtual bool <b><a href="qdesignermembersheetextension.html#isVisible">isVisible</a></b> ( int <i>index</i> ) const = 0</li>
<li><div class="fn"/>virtual QString <b><a href="qdesignermembersheetextension.html#memberGroup">memberGroup</a></b> ( int <i>index</i> ) const = 0</li>
<li><div class="fn"/>virtual QString <b><a href="qdesignermembersheetextension.html#memberName">memberName</a></b> ( int <i>index</i> ) const = 0</li>
<li><div class="fn"/>virtual QList&lt;QByteArray&gt; <b><a href="qdesignermembersheetextension.html#parameterNames">parameterNames</a></b> ( int <i>index</i> ) const = 0</li>
<li><div class="fn"/>virtual QList&lt;QByteArray&gt; <b><a href="qdesignermembersheetextension.html#parameterTypes">parameterTypes</a></b> ( int <i>index</i> ) const = 0</li>
<li><div class="fn"/>virtual void <b><a href="qdesignermembersheetextension.html#setMemberGroup">setMemberGroup</a></b> ( int <i>index</i>, const QString &amp; <i>group</i> ) = 0</li>
<li><div class="fn"/>virtual void <b><a href="qdesignermembersheetextension.html#setVisible">setVisible</a></b> ( int <i>index</i>, bool <i>visible</i> ) = 0</li>
<li><div class="fn"/>virtual QString <b><a href="qdesignermembersheetextension.html#signature">signature</a></b> ( int <i>index</i> ) const = 0</li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QDesignerMemberSheetExtension class allows you to manipulate a widget's member functions which is displayed when configuring connections using Qt Designer's mode for editing signals and slots.</p>
<p>QDesignerMemberSheetExtension is a collection of functions that is typically used to query a widget's member functions, and to manipulate the member functions' appearance in <i>Qt Designer</i>'s signals and slots editing mode. For example:</p>
<pre> QDesignerMemberSheetExtension *memberSheet  = 0;
 QExtensionManager manager = formEditor-&gt;extensionManager();

 memberSheet = qt_extension&lt;QDesignerMemberSheetExtension*&gt;(manager, widget);
 int index = memberSheet-&gt;indexOf(setEchoMode);
 memberSheet-&gt;setVisible(index, false);

 delete memberSheet;</pre>
<p>When implementing a custom widget plugin, a pointer to <i>Qt Designer</i>'s current <a href="qdesignerformeditorinterface.html">QDesignerFormEditorInterface</a> object (<tt>formEditor</tt> in the example above) is provided by the <a href="qdesignercustomwidgetinterface.html#initialize">QDesignerCustomWidgetInterface::initialize</a>() function's parameter.</p>
<p>The member sheet (and any other extension), can be retrieved by querying <i>Qt Designer</i>'s extension manager using the <a href="qextensionmanager.html#qt_extension">qt_extension</a>() function. When you want to release the extension, you only need to delete the pointer.</p>
<p>All widgets have a default member sheet used in <i>Qt Designer</i>'s signals and slots editing mode with the widget's member functions. But QDesignerMemberSheetExtension also provides an interface for creating custom member sheet extensions.</p>
<p><b>Warning:</b> <i>Qt Designer</i> uses the QDesignerMemberSheetExtension to facilitate the signal and slot editing mode. Whenever a connection between two widgets is requested, <i>Qt Designer</i> will query for the widgets' member sheet extensions. If a widget has an implemented member sheet extension, this extension will override the default member sheet.</p>
<p>To create a member sheet extension, your extension class must inherit from both <a href="qobject.html">QObject</a> and QDesignerMemberSheetExtension. Then, since we are implementing an interface, we must ensure that it's made known to the meta object system using the <a href="qobject.html#Q_INTERFACES">Q_INTERFACES</a>() macro:</p>
<pre> class MyMemberSheetExtension : public QObject,
         public QDesignerMemberSheetExtension
 {
     Q_OBJECT
     Q_INTERFACES(QDesignerMemberSheetExtension)

 public:
     ...
 }</pre>
<p>This enables <i>Qt Designer</i> to use <a href="qobject.html#qobject_cast">qobject_cast</a>() to query for supported interfaces using nothing but a <a href="qobject.html">QObject</a> pointer.</p>
<p>In <i>Qt Designer</i> the extensions are not created until they are required. For that reason, when implementing a member sheet extension, you must also create a <a href="qextensionfactory.html">QExtensionFactory</a>, i.e a class that is able to make an instance of your extension, and register it using <i>Qt Designer</i>'s <a href="qextensionmanager.html">extension manager</a>.</p>
<p>When a widget's member sheet extension is required, <i>Qt Designer</i>'s <a href="qextensionmanager.html">extension manager</a> will run through all its registered factories calling <a href="qextensionfactory.html#createExtension">QExtensionFactory::createExtension</a>() for each until the first one that is able to create a member sheet extension for that widget, is found. This factory will then make an instance of the extension. If no such factory is found, <i>Qt Designer</i> will use the default member sheet.</p>
<p>There are four available types of extensions in <i>Qt Designer</i>: <a href="qdesignercontainerextension.html">QDesignerContainerExtension</a>, QDesignerMemberSheetExtension, <a href="qdesignerpropertysheetextension.html">QDesignerPropertySheetExtension</a> and <a href="qdesignertaskmenuextension.html">QDesignerTaskMenuExtension</a>. <i>Qt Designer</i>'s behavior is the same whether the requested extension is associated with a multi page container, a member sheet, a property sheet or a task menu.</p>
<p>The <a href="qextensionfactory.html">QExtensionFactory</a> class provides a standard extension factory, and can also be used as an interface for custom extension factories. You can either create a new <a href="qextensionfactory.html">QExtensionFactory</a> and reimplement the <a href="qextensionfactory.html#createExtension">QExtensionFactory::createExtension</a>() function. For example:</p>
<pre>  QObject *ANewExtensionFactory::createExtension(QObject *object,
          const QString &amp;iid, QObject *parent) const
  {
      if (iid != Q_TYPEID(QDesignerMemberSheetExtension))
          return 0;

      if (MyCustomWidget *widget = qobject_cast&lt;MyCustomWidget*&gt;
             (object))
          return new MyMemberSheetExtension(widget, parent);

      return 0;
  }</pre>
<p>Or you can use an existing factory, expanding the <a href="qextensionfactory.html#createExtension">QExtensionFactory::createExtension</a>() function to make the factory able to create a member sheet extension as well. For example:</p>
<pre>  QObject *AGeneralExtensionFactory::createExtension(QObject *object,
          const QString &amp;iid, QObject *parent) const
  {
      MyCustomWidget *widget = qobject_cast&lt;MyCustomWidget*&gt;(object);

      if (widget &amp;&amp; (iid == Q_TYPEID(QDesignerTaskMenuExtension))) {
          return new MyTaskMenuExtension(widget, parent);

      } else if (widget &amp;&amp; (iid == Q_TYPEID(QDesignerMemberSheetExtension))) {
          return new MyMemberSheetExtension(widget, parent);

      } else {
          return 0;
      }
  }</pre>
<p>For a complete example using an extension class, see <a href="designer-taskmenuextension.html">Task Menu Extension example</a>. The example shows how to create a custom widget plugin for Qt Designer, and how to to use the <a href="qdesignertaskmenuextension.html">QDesignerTaskMenuExtension</a> class to add custom items to <i>Qt Designer</i>'s task menu.</p>
<p>See also <a href="qextensionfactory.html">QExtensionFactory</a>, <a href="qextensionmanager.html">QExtensionManager</a>, and <a href="designer-creating-custom-widgets-extensions.html">Creating Custom Widget Extensions</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="dtor.QDesignerMemberSheetExtension"></a>QDesignerMemberSheetExtension::~QDesignerMemberSheetExtension ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>Destroys the member sheet extension.</p>
<h3 class="fn"><a name="count"></a>int QDesignerMemberSheetExtension::count () const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Returns the extension's number of member functions.</p>
<h3 class="fn"><a name="declaredInClass"></a><a href="qstring.html">QString</a> QDesignerMemberSheetExtension::declaredInClass ( int <i>index</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Returns the name of the class in which the member function with the given <i>index</i> is declared.</p>
<p>See also <a href="qdesignermembersheetextension.html#indexOf">indexOf</a>().</p>
<h3 class="fn"><a name="indexOf"></a>int QDesignerMemberSheetExtension::indexOf ( const <a href="qstring.html">QString</a> &amp; <i>name</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Returns the index of the member function specified by the given <i>name</i>.</p>
<p>See also <a href="qdesignermembersheetextension.html#memberName">memberName</a>().</p>
<h3 class="fn"><a name="inheritedFromWidget"></a>bool QDesignerMemberSheetExtension::inheritedFromWidget ( int <i>index</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Returns true if the member function with the given <i>index</i> is inherited from <a href="qwidget.html">QWidget</a>, otherwise false.</p>
<p>See also <a href="qdesignermembersheetextension.html#indexOf">indexOf</a>().</p>
<h3 class="fn"><a name="isSignal"></a>bool QDesignerMemberSheetExtension::isSignal ( int <i>index</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Returns true if the member function with the given <i>index</i> is a signal, otherwise false.</p>
<p>See also <a href="qdesignermembersheetextension.html#indexOf">indexOf</a>().</p>
<h3 class="fn"><a name="isSlot"></a>bool QDesignerMemberSheetExtension::isSlot ( int <i>index</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Returns true if the member function with the given <i>index</i> is a slot, otherwise false.</p>
<p>See also <a href="qdesignermembersheetextension.html#indexOf">indexOf</a>().</p>
<h3 class="fn"><a name="isVisible"></a>bool QDesignerMemberSheetExtension::isVisible ( int <i>index</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Returns true if the member function with the given <i>index</i> is visible in <i>Qt Designer</i>'s signal and slot editor, otherwise false.</p>
<p>See also <a href="qdesignermembersheetextension.html#indexOf">indexOf</a>() and <a href="qdesignermembersheetextension.html#setVisible">setVisible</a>().</p>
<h3 class="fn"><a name="memberGroup"></a><a href="qstring.html">QString</a> QDesignerMemberSheetExtension::memberGroup ( int <i>index</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Returns the name of the member group specified for the function with the given <i>index</i>.</p>
<p>See also <a href="qdesignermembersheetextension.html#indexOf">indexOf</a>() and <a href="qdesignermembersheetextension.html#setMemberGroup">setMemberGroup</a>().</p>
<h3 class="fn"><a name="memberName"></a><a href="qstring.html">QString</a> QDesignerMemberSheetExtension::memberName ( int <i>index</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Returns the name of the member function with the given <i>index</i>.</p>
<p>See also <a href="qdesignermembersheetextension.html#indexOf">indexOf</a>().</p>
<h3 class="fn"><a name="parameterNames"></a><a href="qlist.html">QList</a>&lt;<a href="qbytearray.html">QByteArray</a>&gt; QDesignerMemberSheetExtension::parameterNames ( int <i>index</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Returns the parameter names of the member function with the given <i>index</i>, as a <a href="qbytearray.html">QByteArray</a> list.</p>
<p>See also <a href="qdesignermembersheetextension.html#indexOf">indexOf</a>() and <a href="qdesignermembersheetextension.html#parameterTypes">parameterTypes</a>().</p>
<h3 class="fn"><a name="parameterTypes"></a><a href="qlist.html">QList</a>&lt;<a href="qbytearray.html">QByteArray</a>&gt; QDesignerMemberSheetExtension::parameterTypes ( int <i>index</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Returns the parameter types of the member function with the given <i>index</i>, as a <a href="qbytearray.html">QByteArray</a> list.</p>
<p>See also <a href="qdesignermembersheetextension.html#indexOf">indexOf</a>() and <a href="qdesignermembersheetextension.html#parameterNames">parameterNames</a>().</p>
<h3 class="fn"><a name="setMemberGroup"></a>void QDesignerMemberSheetExtension::setMemberGroup ( int <i>index</i>, const <a href="qstring.html">QString</a> &amp; <i>group</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Sets the member group of the member function with the given <i>index</i>, to <i>group</i>.</p>
<p>See also <a href="qdesignermembersheetextension.html#indexOf">indexOf</a>() and <a href="qdesignermembersheetextension.html#memberGroup">memberGroup</a>().</p>
<h3 class="fn"><a name="setVisible"></a>void QDesignerMemberSheetExtension::setVisible ( int <i>index</i>, bool <i>visible</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>If <i>visible</i> is true, the member function with the given <i>index</i> is visible in <i>Qt Designer</i>'s signals and slots editing mode; otherwise the member function is hidden.</p>
<p>See also <a href="qdesignermembersheetextension.html#indexOf">indexOf</a>() and <a href="qdesignermembersheetextension.html#isVisible">isVisible</a>().</p>
<h3 class="fn"><a name="signature"></a><a href="qstring.html">QString</a> QDesignerMemberSheetExtension::signature ( int <i>index</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Returns the signature of the member function with the given <i>index</i>.</p>
<p>See also <a href="qdesignermembersheetextension.html#indexOf">indexOf</a>().</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
